package com.yqd.lesson.actor.eight

import scala.concurrent.duration._
import akka.actor.{ActorRef, ActorSystem, Props}

/*
  Actor 最基本的用法
 */
object Main extends App{

  //用户创建的顶级actor的监管者
  val system = ActorSystem("akka");

  val sender: ActorRef = system.actorOf(Props[StateMachine],"sender")

  var count:Int = 0;
  import system.dispatcher
  system.scheduler.schedule(1.second,1.second){
    count += 1;
    println("record:" + count)
    sender ! StateMachine.Data(count)
  }

}
